package com.stadium.common.enums;

public enum RecordEnum {

    前传前掉("1", "前传/前掉"),
    扑搂("2", "扑搂"),
    自由踢罚踢("3", "自由踢/罚踢"),
    惩罚达阵("4", "惩罚达阵"),
    界外球权("5", "界外球权"),

    司克兰球权("6", "司克兰球权"),

    达阵("7", "达阵"),

    踢球攻门("8", "踢球攻门"),

    追加射门("9", "追加射门"),

    犯规("10", "犯规"),

    黄牌("11", "黄牌"),

    红牌("12", "换人-红牌"),

    SUBSTITUTE_UP("13", "换人-上场"),

    SUBSTITUTE_DOWN("14", "换人-下场"),

    UNKNOWN("0", "未知");
    private String code;
    private String name;

    RecordEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static RecordEnum getRecordByCode(String code) {
        for (RecordEnum positionEnum : RecordEnum.values()) {
            if (code.equals(positionEnum.getCode())) {
                return positionEnum;
            }
        }
        return RecordEnum.UNKNOWN;
    }

    public static RecordEnum getRecordByName(String name) {
        for (RecordEnum positionEnum : RecordEnum.values()) {
            if (name.equals(positionEnum.getName())) {
                return positionEnum;
            }
        }
        return RecordEnum.UNKNOWN;
    }
}
